Deblocking Filtering Control

ABSTRACT

A first filter decision value is calculated for a block of pixels in a video frame based on pixel values of pixels in a first line of pixels in the block. A second filter decision value is also calculated for the block based on pixel values of pixels in a corresponding first line of pixels in a neighboring block in the video frame. The first filter decision value is used to determine how many pixels in a line of pixels in the block to filter relative to a block boundary between the block and the neighboring block. The second filter decision value is used to determine how many pixels in a corresponding line of pixels in the neighboring block to filter relative to the block boundary.

TECHNICAL FIELD

The present embodiments generally relate to filtering control and inparticular to controlling deblocking filtering over block boundaries ina video frame.

BACKGROUND

Deblocking filters are used in the video coding standards in order tocombat blocking artifacts. The blocking artifacts arise because theoriginal video frames are split into blocks which are processedrelatively independently. The blocking artifacts can, for instance,arise due to different intra predictions of the blocks, quantizationeffects and motion compensation. Two particular variants of deblockingare described below.

In state of the art video coding, such as H.264, there is a deblockingfilter, also denoted loop filter, after prediction and residualreconstruction, but before storage of the reconstruction for laterreference when encoding or decoding the subsequent frames. Thedeblocking filtering consists of several steps such as filter decisions,filtering operations, a clipping function and changes of pixel values.The decision to filter the border or not is made based on evaluation ofseveral conditions. Filter decisions depend on macroblock (MB) type,motion vector (MV) difference between neighboring blocks, whetherneighboring blocks have coded residuals and on the local structure ofthe current and/or neighboring blocks.

Then the amount of filtering for a pixel depends, among others, on theposition of that pixel relative to the block border or boundary and onthe quantization parameter (QP) value used for residual coding.

The filter decision is based on comparing three pixel differences withthresholds. The thresholds are adapted to the quantization parameter(QP). For instance, assume a vertical block boundary of:

-   -   abcd|efgh        where a, b c and d denote the pixel values of the pixels of a        row of pixels in the current block and e, f, g and h denote the        corresponding pixel values of the pixels of a corresponding row        of pixels in the neighboring block. If the following conditions        are fulfilled the filter decision is positive, e.g.        abs(d−e)<thr1, abs(c−d)<thr2, and abs(e−f)<thr2, where thr1 and        thr2 are adapted based on QP.

There are two filtering modes in H.264. In the first filtering mode,referred to as normal filtering, filtering can be described with a deltavalue with which filtering changes the current value. The filtering forthe pixels closest to the block boundary is d′=d+delta and e′=e−delta,where delta has been clipped off to a threshold ±thr3 to a value that isconstrained by the QP. More filtering is thereby allowed for high QPthan for low QP. Clipping can be described as delta_clipped=max(−thr3,min(thr3, delta)), where thr3 is controlling the filter strength. Alarger value of thr3 means that the filtering is stronger which meansthat a stronger low-pass filtering effect will happen.

The filter strength can be increased if any of the following twoconditions also holds, e.g. abs(b−d)<thr2 and abs(e−g)<thr2. The filterstrength is adapted by clipping the delta less, e.g. allow for morevariation.

The second filtering mode, referred to as strong filtering, is appliedfor intra macroblock boundaries only, when the following condition isfulfilled abs(d−e)<thr1/4.

For more information of deblocking filtering in H.264 reference is madeto List et al., Adaptive Deblocking Filter, IEEE Transactions onCircuits and Systems for Video Technology, vol. 13, no. 7, July 2003.

In the draft HEVC (High Efficiency Video Coding) specification “TestModel under Consideration”, ITU-T SG16 WP3 document, JCTVC-B205, Chapter6.5 In-loop filter process, the deblocking filter works differently fromH.264. The filtering is performed if at least one of the blocks on theside of the boundary is intra, or has non-zero coefficients, or thedifference between the motion vector components of the blocks is greateror equal to one integer pixel. For example, when filtering the borderbetween the blocks with a vertical block boundary of

p3_(i) p2_(i) p1_(i) ,p0_(i) |q0_(i) q1_(i) q2_(i) q3_(i)

with pj_(i) denoting the pixel value of pixel number j of row number iin the current block and qj_(i) denoting the pixel value of pixel numberj of row number i in the neighboring block, i=0 . . . 7, j=0 . . . 3,then the following condition should also be satisfied:

d=|p2₂−2×p1₂ +p0₂ |+|q2₂−2×q1₂ +q0₂ |+|p ₂5−2×p1₅ +p0₅ |+q2₅−2×q1₅+q0₅|<β

where β depends on QP. In the above mentioned HEVC specification, thereis a table of β, where β increases with QP.

If the conditions are fulfilled and filtering is done between thecurrent block and the neighboring block, one of two types of filteringis performed, referred to as weak and strong filtering, respectively.The choice between the strong and the weak filtering is done separatelyfor each line depending on the following conditions. For each line i=0 .. . 7, the strong filtering is performed if all the following conditionsare true, otherwise, weak filtering is performed:

d<(β>>2)

(|p3_(i) −p0_(i) |+|q0_(i) −q3_(i)|)<(β>>3)

|p0_(i) −q0_(i)|<((5×t _(C)+1)>>1)

where t_(C) and β depend on QP and >> denotes a right shift operator.

Weak filtering is performed based on the above conditions. The actualfiltering works by computing an offset (Δ), adding it to the originalpixel value and clip the sum to a filtered output pixel value in therange of 0-255:

Δ=Clip(−t _(C) ,t _(C),(13×(q0_(i) −p0_(i))+4×(q1_(i) −p1_(i))−5×(q2_(i)−p2_(i))+16)>>5))

p0_(i)=Clip₀₋₂₅₅(p0_(i)+Δ)

q0_(i)=Clip₀₋₂₅₅(q0_(i)−Δ)

p1_(i)=Clip₀₋₂₅₅(p1_(i)+Δ/2)

q1_(i)=Clip₀₋₂₅₅(q1_(i)−Δ/2)

where the clip function Clip(A, B, x) is defined as Clip(A, B, x)=A ifx<A, Clip(A, B, x)=B if x>B and Clip(A, B, x)=x if A≦x≦B andClip₀₋₂₅₅(x) is defined as Clip(0, 255, x).

Strong filtering mode is performed by the following set of operations:

p0_(i)=Clip₀₋₂₅₅((p2_(i)+2×p1_(i)+2×p0_(i)+2×q0_(i) +q1_(i)+4)>>3)

q0_(i)=Clip₀₋₂₅₅((p1_(i)+2×p0_(i)+2×q0_(i)+2×q1_(i) +q2_(i)+4)>>3)

p1_(i)=Clip₀₋₂₅₅((p2_(i) +p1_(i) +p0_(i) +q0_(i)+2)>>2)

q1_(i)=Clip₀₋₂₅₅((p0_(i) +q0_(i) +q1_(i) +q2_(i)+2)>>2)

p2_(i)=Clip₀₋₂₅₅((2×p3_(i)+3×p2_(i) +p1_(i) +p0_(i) +q0_(i)+4)>>3)

q2_(i)=Clip₀₋₂₅₅((p0_(i) +q0_(i) +q1_(i)+3×q2_(i)+2×q3_(i)+4)>>3)

Deblocking filtering decisions according to HEVC can lead to inaccuratedeblocking filtering over block boundaries for certain blocks. Inparticular, neighboring blocks having different levels of localstructures could be handled incorrectly in HEVC by filtering one of theblocks too much to thereby represses and filter away local structures inthe block.

SUMMARY

Hence, there is a need for an efficient deblocking filtering controlthat can be used to reduce blocking artifacts at block boundaries andthat does not have the above-mentioned drawbacks.

It is a general objective to provide an efficient deblocking filteringcontrol.

It is a particular objective to provide asymmetric filtering decisionsover a block boundary.

An aspect of the embodiments relates to a method for filtering controlapplicable to a block of multiple pixels in a video frame, where eachpixel has a respective pixel value. The method comprises calculating afirst filter decision value for the block based at least on|p2_(i)−2p1_(i)+p0_(i)|, wherein p0_(i) denotes a pixel value of a pixelclosest to, in a first line of pixels in the block, a block boundary toa neighboring block of multiple pixels in the video frame, p1_(i)denotes a pixel value of a pixel next closest to, in the first line ofpixels, the block boundary and p2_(i) denotes a pixel value of a pixelsecond next closest to, in the first line of pixels, the block boundary.The method also comprises calculating a second filter decision value forthe block based at least on |q2_(i)−2q1_(i)+q0_(i)|, wherein q0_(i)denotes a pixel value of a pixel in the neighboring block closest to, ina corresponding first line of pixels in the neighboring block, the blockboundary, q1_(i) denotes a pixel value of a pixel of the neighboringblock next closest to, in the corresponding first line of pixels, theblock boundary and q2_(i) denotes a pixel value of a pixel in theneighboring block second next closest to, in the corresponding firstline of pixels, the block boundary. The first filter decision value isused to determine how many pixels in a line of pixels in the block tofilter relative to the block boundary and the second filter decisionvalue is correspondingly used to determine how many pixels in acorresponding line of pixels in the neighboring block to filter relativeto the block boundary.

Another aspect of the embodiments defines a filtering control devicecomprising a first decision value calculator configured to calculate afirst filter decision value for a block of multiple pixels in a videoframe based at least on |p2_(i)−2p1_(i)+p0_(i)|, wherein p0_(i) denotesa pixel value of a pixel closest to, in a first line of pixels in theblock, a block boundary to a neighboring block of multiple pixels in thevideo frame, p1_(i) denotes a pixel value of a pixel next closest to, inthe first line of pixels, the block boundary and p2_(i) denotes a pixelvalue of a pixel second next closest to, in the first line of pixels,the block boundary. The filtering control device also comprises a seconddecision value calculator configured to calculate a second filterdecision value for the block based at least on |q2_(i)−2q1_(i)+q0_(i)|,wherein q0_(i) denotes a pixel value of a pixel in the neighboring blockclosest to, in a corresponding first line of pixels in the neighboringblock, the block boundary, q1_(i) denotes a pixel value of a pixel ofthe neighboring block next closest to, in the corresponding first lineof pixels, the block boundary and q2_(i) denotes a pixel value of apixel in the neighboring block second next closest to, in thecorresponding first line of pixels, the block boundary. A first pixeldeterminer is configured to determine how many pixels in a line ofpixels in the block to filter relative to the block boundary based onthe first filter decision value calculated by the first decision valuecalculator. The filtering control device further comprises a secondpixel determiner configured to determine how many pixels in acorresponding line of pixels in the neighboring block to filter relativeto the block boundary based on the second filter decision valuecalculated by the second decision value calculator.

Further aspects of the embodiments relate to an encoder comprising afiltering control device as defined above and a decoder comprising afiltering control device as defined above.

Yet another aspect defines a user equipment comprising a memoryconfigured to store video frames and an encoder with a filtering controldevice as defined above to encode the video frames into encoded videoframes, which are stored in the memory. A further aspect defines a userequipment comprising a memory configured to store encoded video framesand a decoder with a filtering control device as defined above to decodethe encoded video frames into decoded video frames. A media player ofthe user equipment is configured to render the decoded video frames intovideo data displayable on a display.

Yet another aspect relates to a computer program for filtering controlof a block of multiple pixels in a video frame, where each pixel has arespective pixel value. The computer program comprises code means whichwhen run on a computer causes the computer to calculate a first filterdecision value for the block based at least on |p2_(i)−2p1_(i)+p0_(i)|,wherein p0_(i) denotes a pixel value of a pixel closest to, in a firstline of pixels in the block, a block boundary to a neighboring block ofmultiple pixels in the video frame, p1_(i) denotes a pixel value of apixel next closest to, in the first line of pixels, the block boundaryand p2_(i) denotes a pixel value of a pixel second next closest to, inthe first line of pixels, the block boundary. The computer alsocomprises code means which causes the computer to calculate a secondfilter decision value for the block based at least on|q2_(i)−2q1_(i)+q0_(i)|, wherein q0_(i) denotes a pixel value of a pixelin the neighboring block closest to, in a corresponding first line ofpixels in the neighboring block, the block boundary, q1_(i) denotes apixel value of a pixel of the neighboring block next closest to, in thecorresponding first line of pixels, the block boundary and q2_(i)denotes a pixel value of a pixel in the neighboring block second nextclosest to, in the corresponding first line of pixels, the blockboundary. The computer program comprises code means which causes thecomputer to determine how many pixels in a line of pixels in the blockto filter relative to the block boundary based on the first filterdecision value and determine how many pixels in a corresponding line ofpixels in the neighboring block to filter relative to the block boundarybased on the second filter decision value.

The embodiments achieve asymmetric deblocking decisions that controldeblocking filtering to be adaptive to the structure on each side of ablock boundary. The asymmetric decisions mean that the amount offiltering applied to one side of the block boundary can differ from theamount of filtering applied to the other side of the block boundary,thus providing additional adaptation to the local structure. Thisimproves the objective and subjective video quality.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention, together with further objects and advantages thereof, maybest be understood by making reference to the following descriptiontaken together with the accompanying drawings, in which:

FIG. 1 is a flow diagram of a method for filtering control according toan embodiment;

FIGS. 2A and 2B illustrate two embodiments of neighboring blocks and ablock boundary over which deblocking filtering can be applied;

FIG. 3 is a flow diagram illustrating additional, optional steps of themethod in FIG. 1 according to an embodiment;

FIG. 4 is a flow diagram illustrating an embodiment of the determiningsteps in FIG. 1;

FIG. 5 is a flow diagram illustrating additional, optional steps of themethod in FIG. 1 according to another embodiment;

FIG. 6 is a flow diagram illustrating additional, optional steps of themethod in FIG. 1 and an embodiment of the determining steps in FIG. 1;

FIG. 7 is a flow diagram illustrating an additional, optional step ofthe method in FIG. 1 according to an embodiment;

FIG. 8 is a schematic block diagram of an embodiment of a filteringcontrol device;

FIG. 9 is a schematic block diagram of another embodiment of a filteringcontrol device;

FIG. 10 is a schematic block diagram of a further embodiment of afiltering control device;

FIG. 11 is a schematic block diagram of yet another embodiment of afiltering control device;

FIG. 12 is a schematic block diagram of a software implementation of afiltering control device in a computer according to an embodiment;

FIG. 13 is a schematic block diagram of an encoder according to anembodiment;

FIG. 14 is a schematic block diagram of a decoder according to anembodiment;

FIG. 15 is a schematic block diagram of a user equipment according to anembodiment;

FIG. 16 is a schematic block diagram of a user equipment according toanother embodiment; and

FIG. 17 is a schematic overview of a portion of a communication networkcomprising a network device according to an embodiment.

DETAILED DESCRIPTION

Throughout the drawings, the same reference numbers are used for similaror corresponding elements.

The embodiments generally relate to filtering control and controllingdeblocking filtering over block boundaries in a video frame. Thefiltering control of the embodiments provides asymmetric deblockingdecisions with regard to block boundaries by making independentfiltering decisions for the blocks of pixels separated by a blockboundary. This means that the deblocking filtering can handleneighboring blocks having different levels of local structures tothereby adapt the particular deblocking filtering at each block based onits local structures.

As is well-known in the art, a video frame is divided intonon-overlapping blocks of pixels that are encoded and decoded accordingto the various available intra and inter coding modes. Generally, avideo frame is divided into non-overlapping macroblocks of 16×16 pixels.Such a macroblock can in turn be divided into smaller blocks ofdifferent sizes, such as 4×4 or 8×8 pixels. However, also rectangularblocks are possible according to the embodiments, such as, 4×8, 8×4,8×16 or 16×8. The embodiments can be applied to any such block ofpixels, including macroblocks or even larger blocks of pixels.

In the emerging High Efficiency Video Coding (HEVC) standard, codingunits (CU), prediction units (PU) and transform units (TU) are used. Theprediction units are defined inside a coding unit and contain the intraor inter prediction modes. Transform units are defined inside a codingunit and the largest transform size is 32×32 pixels and the smallestsize is 4×4 pixels. The CU size is currently varying from 64×64 pixels(largest) to 8×8 pixels (smallest). In this way, the largest CU can besplit into smaller CUs with the “level of granularity” depending on thelocal characteristics of the frame. That means that the largest CU maybe split into smaller CUs of different sizes. The embodiments can alsobe used in connection with such coding units, which are regarded asbeing encompassed by the expression “block of pixels” as used herein.

Each pixel in the block has a respective pixel value. Video framesgenerally have color values assigned to the pixels, where the colorvalues are represented in a defined color formats. One of the commoncolor formats uses one luminance component and two chrominancecomponents for each pixel, although other formats exist, such as usingred, green and blue components for each pixel.

Traditionally, luminance component filtering and chrominance componentfiltering are done separately, possibly employing different filteringdecisions and different deblocking filters. It is, though, possible thatthe luminance filtering decisions are used in chroma filtering, like inH.264. The embodiments can be applied to filtering control for theluminance component, the chrominance component or both the luminancecomponent and the chrominance component. In a particular embodiment, theembodiments are applied to control luminance or luma filtering.Filtering decisions, or parts of filtering decisions for one component,such as luma, can be then used when making the filtering decisions forother components, such as chroma.

Deblocking filtering is conducted over a boundary, edge or borderbetween neighboring blocks. As a consequence, such boundaries can bevertical boundaries 1, see FIG. 2A, between two neighboring blocks 10,20 present side by side in the video frame. Alternatively, theboundaries are horizontal boundaries 1, see FIG. 2B, between twoneighboring block 10, 20, where one block 10 is positioned above theother block 20 in the video frame. In a particular embodiment, verticalboundaries are filtered first starting from the left-most boundary andproceeding through the boundaries towards the right-hand side in theirgeometrical order. Then, horizontal boundaries are filtered startingwith the boundary on the top and proceeding through the boundariestowards the bottom in their geometrical order. The embodiments are,however, not limited to this particular filtering order and can actuallybe applied to any predefined filtering order. In a particularembodiment, the boundaries at the edge of the video frame are preferablynot filtered and thereby excluded from the deblocking filtering.

FIG. 1 is a flow diagram of a method for filtering control applicable toa block of multiple pixels in a video frame according to an embodiment.The method of FIG. 1 generally starts in step S1 where a first filterdecision value is calculated for the block based at least on|p2_(i)−2p1_(i)+p0_(i)|, wherein p0_(i) denotes a pixel value of a pixel11 closest to, in a first line of pixels 11, 13, 15, 17 in the block 10,a block boundary 1 to a neighboring block 20 of multiple pixels 21, 23,25, 27 in the video frame. p1_(i) denotes a pixel value of a pixel 13next closest to, in the first line 12 of pixels 11, 13, 15, 17, theblock boundary 1 and p2_(i) denotes a pixel value of a pixel 15 secondnext closest to, in the first line 12 of pixels 11, 13, 15, 17, theblock boundary 10.

Step S2 correspondingly calculates a second filter decision value forthe block based at least on |q2_(i)−2q1_(i)+q0_(i)|, wherein q0_(i)denotes a pixel value of a pixel 21 in the neighboring block 20 closestto, in a corresponding first line 22 of pixels 21, 23, 25, 27 in theneighboring block 20, the block boundary 1, q1_(i) denotes a pixel valueof a pixel 23 of the neighboring block 20 next closest to, in thecorresponding first line 22 of pixels 21, 23, 25, 27, the block boundary1 and q2_(i) denotes a pixel value of a pixel 25 in the neighboringblock 20 second next closest to, in the corresponding first line 22 ofpixels 21, 23, 25, 27, the block boundary 1.

The first line 12 of pixels 11, 13, 15, 17 in the block 10 and thecorresponding first line 22 of pixels 21, 23, 25, 27 in the neighboringblock 20 belong to the same horizontal line of pixels, i.e. row ofpixels, extending over a vertical boundary 1, see FIG. 2A, or belong tothe same vertical line of pixels, i.e. column of pixels, extending overa horizontal boundary 1, see FIG. 2B. Hence, the first line 12 of pixels11, 13, 15, 17 and the corresponding first line 22 of pixels 21, 23, 25,27 are perpendicular to the block boundary 1 between the block 10 andthe neighboring block 20. Furthermore, the first line 12 of pixels 11,13, 15, 17 in the block 10 and the corresponding first line 22 of pixels21, 23, 25, 27 in the neighboring block 20 have the same line number.For instance, if the block 10 and the neighboring block 20 eachcomprises N, such as eight, rows or columns of pixels, having row orcolumn numbers i=0 . . . N−1 then the first line 10 of pixels 11, 13,15, 17 has line number i in the block 10 and the corresponding firstline 20 of pixels 21, 23, 25, 27 also has line number i but in theneighboring block 20. Thus, first line 12 of pixels 11, 13, 15, 17 inthe block and the corresponding first line 22 of pixels 21, 23, 25, 27in the neighboring block 20 are opposing lines with regard to the blockboundary 1.

According to the embodiments, “line of pixels” and “corresponding lineof pixels” are employed to denote a “row of pixels” and a “correspondingrow of pixels” in the case of a vertical block boundary as in FIG. 2Aand denote a “column of pixels” and a “corresponding column of pixels”in the case of a horizontal block boundary as in FIG. 2B.

The first line 12 of pixels 11, 13, 15, 17 and the corresponding firstline 22 of pixels 21, 23, 25, 27 could be predefined lines in the block10 and the neighboring block 20, respectively. Thus, the first line 12of pixels 11, 13, 15, 17 and the corresponding line 22 of pixels 21, 23,25, 27 have a predefined and fixed line number i with regard to eachblock boundary 1 for which a filtering control is applied.Alternatively, the first line 12 of pixels 11, 13, 15, 17 and thecorresponding first line 22 of pixels 21, 23, 25, 27 could represent acurrent line and a current corresponding line, respectively, which isfurther discussed herein.

The calculation of the first filter decision value in step S1 and thecalculation of the second filter decision value in step S2 can beperformed serially in any order, i.e. step S1 preceding step S2 or stepS2 preceding step S1, or at least partly in parallel. The results ofthese two steps S1, S2 is, thus, a first filter decision value that iscalculated based on pixel values in the block 10 and a second filterdecision value that is calculated based on pixel values in theneighboring block 20 on the other side of the block boundary 1 relativeto the block 10. More preferably, the calculation of the first decisionvalue is performed only based on pixel values in the block 10 andtherefore not based on any pixel values in the neighboring block 20.Correspondingly, the second filter decision value is preferablycalculated based only on pixel values in the neighboring block 20 andnot based on any pixel values in the block 10. The first filter decisionvalue calculated in step S1 is then used in step S3 to determine howmany pixels in a line 12 of pixels 11, 13, 15, 17 in the block 10 tofilter relative to the block boundary 1. The second filter decisionvalue is correspondingly used in step S4 to determine how many pixels ina corresponding line 22 of pixels 21, 23, 25, 27 in the neighboringblock 20 to filter relative to the block boundary 1. Thus, separatefilter decision values are calculated for each side or part of a row orcolumn of pixels extending over the block boundary 1 and a respectivefilter decision is taken for each side or part based on the particularfilter decision value calculated for that side or part.

This should be compared to the prior art where a single or a set offilter decision values is calculated for a line of pixels and thecorresponding line of pixels and where this filter decision value or setof filter decision values is used to decide how many pixels to filter onboth sides of the block boundary. Thus, in the prior art the same numberof pixels is always filtered for the corresponding line of pixels in theneighboring block as is done for the matching line of pixels in theblock.

The present embodiments instead enable an asymmetric filtering controland deblocking filtering by making a separate filter decision for theline 12 of pixels 11, 13, 15, 17 in the block 10 and another, differentfilter decision for the corresponding line 22 of pixels 21, 23, 25, 27in the neighboring block 20. This means that based on the particularfirst and second filter decision values different or the same number ofpixels in the line 12 of pixels 11, 13, 15, 17 could be selected fordeblocking filtering and modification as the number of pixels in thecorresponding line 22 of pixels 21, 23, 25, 27 that are selected fordeblocking filtering and modification.

Generally, herein pX_(y) denotes the pixel value of pixel number Xrelative to the block boundary 1 in a line of pixels having line numbery in the block 10. Correspondingly, qX_(y) denotes the pixel value ofpixel number X relative to block boundary 1 in a corresponding line ofpixels having line number y in the neighboring block 20.

Steps S3 and S4 can be performed serially in any order or indeed atleast partly in parallel.

In a first embodiment, steps S1 and S2 could be performed once for agiven block boundary 1 between the block 10 and the neighboring block 20to thereby calculate a first filter decision value and a second filterdecision value that applies to all lines 12 of pixels 11, 13, 15, 17 inthe block 10 and to all corresponding lines 22 of pixels 21, 23, 25, 27in the neighboring block 20, respectively. In such approach the samefirst number of pixels are preferably filtered and modified in each line12 of pixels 11, 13, 15, 17 in the block 10 with regard to the blockboundary 1, where this first number is determined based on the firstfilter decision value calculated in step S1. Correspondingly, the samesecond number of pixels are preferably filtered and modified in eachcorresponding line 22 of pixels 21, 23, 25, 27 in the neighboring block20 with regard to the block boundary 1, where this second number isdetermined based on the second filter decision value calculated in stepS2.

Alternatively, in a second embodiment the first filter decision valueand the second filter decision value applies to a subset of the lines 12of pixels 11, 13, 15, 17 in the block 10 and to a corresponding subsetof the corresponding lines 22 of pixels 21, 23, 25, 27 in theneighboring block 20. For instance, a pair of filter decision valuescould be used for the first four lines 12 of pixels 11, 13, 15, 17 inthe block and the first four corresponding lines 22 of pixels 21, 23,25, 27 in the neighboring block 20 and with another pair of filterdecision values used for the remaining four lines 12 of pixels 11, 13,15, 17 in the block and the remaining four corresponding lines 22 ofpixels 21, 23, 25, 27 in the neighboring block 20.

In a third embodiment the calculation in step S1 is performed for eachline 12 of pixels 11, 13, 15, 17 in the block 10 and a separatedetermination in step S3 is then performed for each such line 12 ofpixels 11, 13, 15, 17. In such a case, the calculation in step S2 iscorrespondingly performed for each corresponding line 22 of pixels 21,23, 25, 27 in the neighboring block 20 and a separate determination instep S4 is performed for each such corresponding line 22 of pixels 21,23, 25, 27.

Thus, in the third embodiment step S3 comprises determining how manypixels in the first line 12 of pixels 11, 13, 15, 17 in the block 10 tofilter relative to the block boundary 1 based on the first filterdecision value calculated in step S1. Step S4 comprises determining howmany pixels in the corresponding first line 22 of pixels 21, 23, 25, 27in the neighboring block 20 to filter relative to the block boundary 1based on the second filter decision value calculated in step S2.

The following part describes how the third embodiment is appliedseparately for each line (row or column) crossing the block boundary 1.In this example the first filter decision value is defined asd_(pi)=|p2_(i)−2p1_(i)+p0_(i)| and the second filter decision value isdefined as d_(qi)=|q2_(i)−2q1_(i)+q0_(i)|. The method then comprises:

 Calculate d_(pi) , calculate d_(qi) for each line i crossing the blockboundary.  if d_(pi) < thr1 ◯ do normal filtering of line i of currentblock 10, e.g. filter and modify two pixels from the block border orboundary;  else, i.e. if d_(pi) ≧ thr1 ◯ do not filter the second pixelfrom the block border or boundary of line i of the current block 10 ordo not filter any pixels at all on line i of the current block 10;  ifd_(qi) < thr2 ◯ do normal filtering of line i of neighboring block 20,e.g. filter and modify two pixels from the block border or boundary 1; else, i.e. if d_(qi) ≧ thr2 ◯ do not filter the second pixel from theblock border or boundary 1 of line i of the neighboring block 20 or donot filter any pixels at all on line i of the neighboring block 20.

As is illustrated by the example above, the third embodiment of themethod in FIG. 1 can calculate separate first and second filter decisionvalues and therefore make separate determinations of how many pixels tofilter for each row or column in the block 10 and the neighboring block20 relative to the block boundary 1. Thus, in this third embodiment thefirst and second filter decision values are line-specific filterdecision values, i.e. calculated for each line 12 of pixels 11, 13, 15,17 in the block 10 and for each corresponding line 22 of pixels 21, 23,25, 27 in the neighboring block 20.

In the first embodiment, block-specific filter decision values are used.Thus, in such a case a single first filter decision value could becalculated for the block 10 relative to the block boundary 1 and applyto all lines 12 of pixels 11, 13, 15, 17 in the block 10 with regard tothe particular block boundary 1. Correspondingly a single second filterdecision value is calculated for the neighboring block 20 relative tothe block boundary 1 and applies to all corresponding lines 22 of pixels21, 23, 25, 27 in the neighboring block 20 with regard to the particularblock boundary 1.

A first example of this first embodiment involves calculating a firstfilter decision value as |p2₂−2p1₂+p0₂+p2₅−2p1₅+p0₅|, wherein p0₂denotes the pixel value of the pixel closest to, in the first line ofpixels, the block boundary 1, p1₂ denotes the pixel value of the pixelnext closest to, in the first line of pixels, the block boundary 1. p2₂denotes the pixel value of the pixel second next closest to, in thefirst line of pixels, the block boundary 1, p0₅ denotes a pixel value ofa pixel closest to, in a second line of pixels in the block 10, theblock boundary 1, p1₅ denotes a pixel value of a pixel next closest to,in the second line of pixels, the block boundary 1 and p2₅ denotes apixel value of a pixel second next closest to, in the second line ofpixels, the block boundary 1.

The second filter decision value is then preferably calculated as|q2₂−2q1₂+q0₂+q2₅−2q1₅+q0₅|, wherein q0₂ denotes the pixel value of thepixel in the neighboring block 20 closest to, in the corresponding firstline of pixels, the block boundary 1, q1₂ denotes the pixel value of thepixel of the neighboring block 20 next closest to, in the correspondingfirst line of pixels, the block boundary 1, q2₂ denotes the pixel valueof the pixel in the neighboring block 20 second next closest to, in thecorresponding first line of pixels, the block boundary 1, q0₅ denotes apixel value of a pixel in the neighboring block 20 closest to, in acorresponding second line of pixels in the neighboring block 20, theblock boundary 1, q1₅ denotes a pixel value of a pixel of theneighboring block 20 next closest to, in the corresponding second lineof pixels, the block boundary 1 and q2₅ denotes a pixel value of a pixelin the neighboring block 20 second next closest to, in the correspondingsecond line of pixels, the block boundary 1.

The first filter decision value is then used for all lines 12 of pixels11, 13, 15, 17 in the block 10 when determining how many pixels tofilter and the second filter decision value is used for allcorresponding line 22 of pixels 21, 23, 25, 27 in the neighboring block20 when determining how many pixels to filter.

In this first example of the first embodiment, the first line of pixelscorresponds to line i=2 and the corresponding first line corresponds tocorresponding line i=2 and the second line of pixels corresponds to linei=5 and the second corresponding line corresponds to corresponding linei=5. In this case the block 10 preferably comprises eight lines and theneighboring block 20 preferably also comprises eight lines, i.e. i=0-7.

The following part illustrates an implementation example of the firstembodiment. In this implementation example the first filter decisionvalue is defined as d_(p)=|p2₂−2p1₂+p0₂|+|p2₅−2p1+p0₅| and the secondfilter decision value is defined as d_(q)=|q2₂−2q1₂+q0₂|+|q2₅−2q1₅+q0₅|.

 Calculate d_(p) , calculate d_(q) ;  if d_(p) < thr1 ◯ do normalfiltering of current block 10, e.g. filter and modify two pixels fromthe block border or boundary 1;  else, i.e. if d_(p) ≧ thr1 ◯ do notfilter the second pixel from the block border or boundary 1 or do notfilter any pixels at all;  if d_(q) < thr2 ◯ do normal filtering ofneighboring block 20, e.g. filter and modify two pixels from the blockborder or boundary 1;  else, i.e. if d_(q) ≧ thr2 ◯ do not filter thesecond pixel from the block border or boundary 1 or do not filter anypixels at all.

In a second example of the first embodiment the first filter decisionvalue is calculated as a block-specific filter decision value based onpixel values in line i=3 and line i=4 instead of line i=2 and line i=5.The corresponding lines i=3 and i=4 in the neighboring block 20 arepreferably then used for calculating the second filter decision value.The first filter decision value could then be calculated as|p2₃−2p1₃+p0₃|+|p2₄−2p1₄+p0₄| and the second filter decision value iscalculated as |q2₃−2q1₃+q0₃|+|q2₄−2q1₄+q0₄|, wherein p0₃ denotes thepixel value of the pixel closest to, in the first line of pixels, theblock boundary 1, p1₃ denotes the pixel value of the pixel next closestto, in the first line of pixels, the block boundary 1, p2₃ denotes thepixel value of the pixel second next closest to, in the first line ofpixels, the block boundary 1, p0₄ denotes a pixel value of a pixelclosest to, in a second line of pixels in the block 10, the blockboundary 1, p1₄ denotes a pixel value of a pixel next closest to, in thesecond line of pixels, the block boundary 1 and p2₄ denotes a pixelvalue of a pixel second next closest to, in the second line of pixels,the block boundary 1 and q0₃ denotes the pixel value of the pixel in theneighboring block 20 closest to, in the corresponding first line ofpixels, the block boundary 1, q1₃ denotes the pixel value of the pixelof the neighboring block 20 next closest to, in the corresponding firstline of pixels, the block boundary 1, q2₃ denotes the pixel value of thepixel in the neighboring block 20 second next closest to, in thecorresponding first line of pixels, the block boundary 1, q0₄ denotes apixel value of a pixel in the neighboring block 20 closest to, in acorresponding second line of pixels in the neighboring block 20, theblock boundary 1, q1₄ denotes a pixel value of a pixel of theneighboring block 20 next closest to, in the corresponding second lineof pixels, the block boundary 1 and q2₄ denotes a pixel value of a pixelin the neighboring block 20 second next closest to, in the correspondingsecond line of pixels, the block boundary 1.

In the second embodiment a first filter decision value and a secondfilter decision value are calculated for a group of four lines of pixelsand four corresponding lines of pixels. This second embodiment can besuitable if the block and the neighboring block each have a size of 4×4pixels. In addition, the second embodiment could also be used for largerblocks of pixels, such as 8×8 pixels. In the latter case, a pair offilter decisions is calculated for the first four lines pixels and firstfour corresponding lines of pixels and another pair of filter decisionsis calculated for the remaining four lines of pixels and the remainingfour corresponding lines of pixels.

A first example of the second embodiment calculates the first filterdecision value as |p2₀−2p1₀+p0₀|+p2₃−2p1₃+p0₃| and the second filterdecision value as |q2₀−2q1₀+q0₀|+|q2₃−2q1₃+q0₃|. In such a case, theline of pixels and the corresponding line of pixels could run from linenumber i=0 to line number i=3. For larger blocks of pixels, such asi=0-7 as shown in FIGS. 2A and 2B, the first pair of a first filterdecision value and a second filter decision value is calculated as|p2₀−2p1₀+p0₀|+p2₃−2p1₃+p0₃| and |q2₀−2q1₀+q0₀|+|q2₃−2q1₃+q0₃|. Thisfirst pair of filter decision values is applicable to the first fourlines of pixels and first four corresponding line of pixels, i.e. i=0-3.The second pair of a first filter decision value and a second filterdecision value is then calculated as |p2₄−2p1₄+p0₄+|p2₇−2p1₇+p0₇| and|q2₄−2q1₄+q0₄|+|q2₇−2q1₇+q0₇|. The second pair of filter decision valuesis then applicable to the four last line of pixels and the four lastcorresponding line of pixels, i.e. i=4-7.

A second example of the second embodiment calculates the first filterdecision value as |p2₁−2p1₁+p0₁|+|p2₂−2p1₂+p0₂| and the second filterdecision value as |q2₁−2q1₁+q0₁|+|q2₂−2q1₂+q0₂|. In such a case, theline of pixels and the corresponding line of pixels could run from linenumber i=0 to line number i=3. For larger blocks of pixels, such asi=0-7 as shown in FIGS. 2A and 2B, the first pair of a first filterdecision value and a second filter decision value is calculated as|p2₁−2p1₁+p0₁|+|p2₂−2p1₂+p0₂| and |q2₁−2q1₁+q0₁|+|q2₂−2q1₂+q0₂|. Thisfirst pair of filter decision values is applicable to the first fourlines of pixels and first four corresponding line of pixels, i.e. i=0-3.The second pair of a first filter decision value and a second filterdecision value is then calculated as |p2₅−2p1₅+p0₅|+|p2₆−2p1₆+p0₆| and|q2₅−2q1₅+q0₅|+|q2₆−2q1₆+q0₆. The second pair of filter decision valuesis then applicable to the four last line of pixels and the four lastcorresponding line of pixels, i.e. i=4-7.

This concept of the second embodiment can be extended to the case wherethe first filter decision value is calculated based on the pixel valuesof pixels present in a subset of the lines of pixels in the block andthe second filter decision value is calculated based on the pixel valuesof pixels present in a subset of the corresponding lines of pixels inthe neighboring block. Thus, in this general concept of the secondembodiment the first filter decision value could be calculated as|p2_(i)−2p1_(i)+p0_(i)|+|p2_(j)−2p1_(j)+p0_(j)|, wherein i, j representdifferent line numbers in the interval 0 to N−1, with N denoting thetotal number of lines of pixels in the block and the neighboring blockand i≠j. The second filter decision value is then preferably calculatedas |q2_(i)−2q1_(i)+q0_(i)|+|q2_(j)−2q1_(j)+q0_(j)|. This concept can ofcourse be extended with the subset containing more than two of the linesof pixels or the corresponding lines of pixels.

In a related example of the first or third embodiment, the first filterdecision value is calculated as ω _(i)|p2_(i)−2p1_(i)+p0_(i)|+ω_(j)|p2_(j)−2p1_(j)+p0_(j)| and the second filter decision value iscalculated as ω _(i)|q2_(i)−2q1_(i)+q0_(i)+ω_(j)|q2_(j)−2q1_(j)+q0_(j)|. ω _(i),ω _(j) represent differentline-specific weights. This concept can also be extended to the casewith more than two lines of pixels and two corresponding lines ofpixels. In a particular example, a line of pixels or corresponding lineof pixels that is closer to the middle of the block or the neighboringblock could then be assigned a comparatively higher weight as comparedto a line or pixels or corresponding line of pixels that is closer toone of the edges of the block or the neighboring block.

In a fourth embodiment, a combination of block-specific andline-specific filter decision values is used to determine how manypixels to filter for the lines of pixels in the block and thecorresponding lines of pixels in the neighboring block. FIG. 3schematically illustrates such an embodiment. The method starts in stepS10 where a third filter decision value is calculated as|p2₂−2p1₂+p0₂|+|p2₅−2p1₅+p0₅|, wherein p0₂ denotes the pixel value ofthe pixel closest to, in a second line of pixels in the block 10, theblock boundary 1, p1₂ denotes the pixel value of the pixel next closestto, in the second line of pixels, the block boundary 1, p2₂ denotes thepixel value of the pixel second next closest to, in the second line ofpixels, the block boundary 1, p0₅ denotes a pixel value of a pixelclosest to, in a third line of pixels in the block 10, the blockboundary 1, p1₅ denotes a pixel value of a pixel next closest to, in thethird line of pixels, the block boundary 1 and p2₅ denotes a pixel valueof a pixel second next closest to, in the third line of pixels, theblock boundary 1. The second line of pixels preferably corresponds toline number 2 in the block 10 and the third line of pixel preferablycorresponds to line number 5 in the block 10, see FIGS. 2A and 2B.

The next step S11 calculates a fourth filter decision value as|q2₂−2q1₂+q0₂|+|q2₅−2q1₅+q0₅|, wherein q0₂ denotes the pixel value ofthe pixel in the neighboring block 20 closest to, in a correspondingsecond line of pixels in the neighboring block 20, the block boundary 1,q1₂ denotes the pixel value of the pixel of the neighboring block 20next closest to, in the corresponding second line of pixels, the blockboundary 1, q2₂ denotes the pixel value of the pixel in the neighboringblock 20 second next closest to, in the corresponding second line ofpixels, the block boundary 1, q0₅ denotes a pixel value of a pixel inthe neighboring block 20 closest to, in a corresponding third line ofpixels in the neighboring block 20, the block boundary 1, q1₅ denotes apixel value of a pixel of the neighboring block 20 next closest to, inthe corresponding third line of pixels, the block boundary 20 and q2₅denotes a pixel value of a pixel in the neighboring block 20 second nextclosest to, in the corresponding third line of pixels, the blockboundary 1. The second corresponding line of pixels preferablycorresponds to line number 2 in the neighboring block 20 and the thirdcorresponding line of pixel preferably corresponds to line number 5 inthe neighboring block 20, see FIGS. 2A and 2B.

Steps S10 and S11 can be performed serially in any order or at leastpartly in parallel.

The next step S12 compares the third filter decision value calculated instep S10 with a third threshold value (T₃). If the third filter decisionvalue is below the third threshold value the method continues to stepsS1 and then S3 of FIG. 1. Thus, in such a case a respectiveline-specific or first filter decision value is calculated for each linei in the block 10, where i preferably is from 0 to 7. This first filterdecision value is then calculated as |p2_(i)−2p1_(i)+p0_(i)|, in step S1of FIG. 1. Step S3 of FIG. 1 determines how many pixels in the line i ofpixels in the block 10 to filter relative to the block boundary 1 basedon the first filter decision value calculated for the line i of pixelsin step S1. This procedure is performed for each line of pixels in theblock 10. Thus, with a block 10 as illustrated in FIG. 2A or 2B steps S1and S3 will be performed eight times. The method then continues to stepS13 of FIG. 3. Correspondingly, if the third filter decision value isnot below the first threshold value in step S12 the method continues tostep S13.

Step S13 compares the fourth filter decision value calculated in stepS11 with a fourth threshold value (T₄). If the fourth filter decisionvalue is below the fourth threshold the method continues to steps S2 andS4 of FIG. 1. A respective line-specific or second filter decision valueis calculated for each corresponding line i in the neighboring block 20as |q2_(i)−2q1_(i)+q0_(i)| in step S2 of FIG. 1. Step S4 of FIG. 3determines how many pixels in the corresponding line i of pixels in theneighboring block 20 to filter relative to the block boundary 1 based onthe second filter decision value calculated for the corresponding line iof pixels in step S2. This procedure is performed for each correspondingline of pixels in the neighboring block 20. The method then ends.Correspondingly, if the fourth filter decision value is not below thesecond threshold value in step S13 the method ends.

The loop formed by steps S12, S1 and S3 can be performed sequentially inany order relative to the loop formed by steps S13, S2 and S4 or atleast partly in parallel. In an example of this fourth embodiment acombination of block-based and line-based asymmetric filter decisions isused. In this example the third filter decision value is calculated asd_(p)=|p2₂−2p1₂+p0₂|+|p2₅−2p1₅+p0₅| and the fourth filter decision valueis calculated as d_(q)=q2₂−2q1₂+q0₂|+|q2₅−2q1₅+q0₅. The line-specificfilter decision values, i.e. the first and second filter decisionvalues, are calculated as d_(pi)=|p2_(i)−2p1_(i)+p0_(i)| andd_(qi)=|q2_(i)−2q1_(i)+q0_(i)| for line and corresponding line number i,respectively.

 Calculate d_(p) , calculate d_(q) ;  if d_(p) < thr1 ◯ for each linei ▪ calculate d_(pi) for line i ▪ If d_(pi) < thr1  do normal filteringof line i in current block 10, e.g. two pixels from the block border orboundary 1; ▪ else, i.e. if d_(pi) ≧ thr1  do not filter the secondpixel from the block border or boundary 1 of line i of current block 10or do not filter any pixels at all on line i of current block 10; else, i.e. if d_(p) ≧ thr1 ◯ do not filter the second pixel from theblock border or boundary 1 or do not filter any pixels at all;  ifd_(q) < thr1 ◯ for each line i ▪ calculate d_(qi) for line i ▪ if d_(qi)< thr2  do normal filtering of line i in neighboring block 20, e.g. twopixels from the block border or boundary 1; ▪ else, i.e. if d_(qi) ≧thr2  do not filter the second pixel from the block border or boundary1 of line i of neighboring block 20 or do not filter any pixels at allon line i of neighboring block 20;  else, i.e. if d_(q) ≧ thr2 ◯ do notfilter the second pixel from the block border or boundary 1 or do notfilter any pixels at all.

In the above disclosed example the same threshold value has been usedwhen comparing the third filter decision value and the first filterdecision values, i.e. thr1, and the same threshold value has been usedwhen comparing the fourth filter decision value and the second filterdecision values, i.e. thr2. In an alternative approach, a thirdthreshold value is used for the third filter decision value, a firstthreshold value is used for the first filter decision values, a fourththreshold value is used for the fourth filter decision value and asecond threshold value is used for the second threshold values. In aparticular embodiment, the third and fourth threshold values are equaland the first and second threshold values are equal.

FIG. 4 is a flow diagram illustrating a particular embodiment of thedetermining steps S3 and S4 of FIG. 1. The method continues from step S2in FIG. 1. A next step S20 compares the first filter decision value(d_(p)) calculated in step S1 in FIG. 1 to a first threshold value (T₁).If the first filter decision value is below the first threshold valuethe method continues from step S20 to step S21. Step S21 determines tofilter two pixels in the line 12 of pixels 11, 13, 15, 17 in the block10 relative to the block boundary 1. These two pixels are preferably thepixel 11 closest to the block boundary 1 and the pixel 13 next closestto the block boundary 1 in the line 12 of pixels 11, 13, 15, 17.However, if the first filter decision value is not below the firstthreshold in step S20 the method instead continues to step S22. A firstembodiment of step S22 determines to filter one pixel in the line 12 ofpixels 11, 13, 15, 17 in the block 10 relative to the block boundary 1.This pixel 11 is preferably the pixel 11 closest to the block boundary 1in the line 12 of pixels 11, 13, 15, 17. A second embodiment of step S22determines to filter no pixels in the line 12 of pixels 11, 13, 15, 17in the block 10 relative to the block boundary 1.

Steps S23 to S25 perform the corresponding determination for thecorresponding line 22 of pixels 21, 23, 25, 27 in the neighboring block20. Thus, step S23 compares the second filter decision value (d_(q))calculated in step S2 in FIG. 1 with a second threshold value (T₂). Ifthe second filter decision value is below the second threshold value themethod continues to step S24. Step S24 determines to filter two pixelsin the corresponding line 22 of pixels 21, 23, 25, 27 in the neighboringblock 20 relative to the block boundary 1. These two pixels 21, 23 arepreferably the pixel 21 closest to the block boundary 1 and the pixel 23next closest to the block boundary 1 in the corresponding line 22 ofpixels 21, 23, 25, 27. If the second filter decision value is not belowthe second threshold the method instead continues to step S25 from stepS23. A first embodiment of step S25 determines to filter one pixel inthe corresponding line 22 of pixels 21, 23, 25, 27 in the neighboringblock 20 relative to the block boundary 1. This pixel 21 is preferablythe pixel 21 closest to the block boundary 1 in the corresponding line22 of pixels 21, 23, 25, 27. A second embodiment of step S25 determinesto filter no pixels in the corresponding line 22 of pixels 21, 23, 25,27 in the neighboring block relative to the block boundary 1.

Steps S20, S21 and S22 can be performed prior to, following or at leastin parallel to steps S23, S24 and S25.

This concept can be extended by using more than one threshold value perfilter decision value. For instance, if d_(p)<T₁ two pixels are filteredin the line 12 of pixels 11, 13, 15, 17, if T₁≦d_(p)<T₁′ one pixel isfiltered in the line 12 of pixels 11, 13, 15, 17 and if d_(p)T₁′ nopixels are filtered in the line 12 of pixels 11, 13, 15, 17. In thiscase T₁<T₁′. Correspondingly, if d_(q)<T₂ two pixels are filtered in thecorresponding line 22 of pixels 21, 23, 25, 27, if T₂≦d_(q)<T₂′ onepixel is filtered in the corresponding line 22 of pixels 21, 23, 25, 27and if d_(q)≧T₂′ no pixels are filtered in the corresponding line 22 ofpixels 21, 23, 25, 27. In this case T₂<T₂′.

Thus, in a general aspect the closer the first or second filter decisionvalue is to zero the more filtering is to be applied to the particularline or corresponding line of pixels by filtering and possibly modifyingmore pixels in the line or corresponding line of pixels as compared to alarger first or second filter decision value. This means that a zero orlow first or second filter decision value implies no or few structuresbut rather a fairly uniform area in the video frame. Correspondingly, ahigh first or second filter decision value generally reflects localstructures in the area in the video frame, which local structures shouldnot be repressed or filtered away.

This embodiment decreases the computational complexity in connectionwith deblocking filtering since the filtering of the second pixel fromthe block border may happen less frequently as compared to the prior artHEVC solution.

The threshold values discussed in the foregoing and used to compare thedifferent filter decision values are preferably dependent on thequantization parameter (QP) assigned to the block or to the neighboringblock. FIG. 5 schematically illustrates such an approach. The methodstarts in step S30 where the first threshold value, to which the firstfilter decision value is compared (see step S20 in FIG. 4), isdetermined based on a quantization parameter associated with the block10. Correspondingly, step S31 determines the second threshold value, towhich the second threshold value is compared (see step S23 in FIG. 4),based on a quantization parameter associated with the neighboring block20 and/or a quantization parameter associated with the block 10.

For instance, T₁ and T₂ are determined based on the parameter B, whichis determined from the QP value of the block 10 or the neighboring block20. In a particular embodiment, the parameter 3 is read from a tablebased on the QP value, see Table 1 below.

TABLE 1 β and QP values QP 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1718 β 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 7 8 QP 19 20 21 22 23 24 25 26 2728 29 30 31 32 33 34 35 36 37 β 9 10 11 12 13 14 15 16 17 18 20 22 24 2628 30 32 34 36 QP 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55β 38 40 42 44 46 48 50 52 54 56 58 60 62 64 64 64 64 64

In particular embodiments T₁=T₂=β/6 or T₁=T₂=(β+β>>1)>>3. As anothervariant of the embodiment, the thresholds can be read from separatetables, i.e. T₁=function(QP), T₂=function(QP). Also the above mentionedthird and fourth threshold values are preferably determined based on thequantization parameter associated with the block and the neighboringblock, respectively.

FIG. 6 is a flow diagram illustrating how the filtering control of theembodiments can be used in connection with a filtering process. Themethod starts in step S40 where a first offset or delta value Δ iscalculated based on

$\frac{{9\left( {{q\; 0_{j}} - {p\; 0_{j}}} \right)} - {3\left( {{q\; 1_{j}} - {p\; 1_{j}}} \right)}}{16},$

wherein p0_(j) denotes a pixel value of a pixel 11 closest to, in a line12 of pixels 11, 13, 15, 17, the block boundary 1, p1_(j) denotes apixel value of a pixel 13 next closest to, in the line 12 of pixels 11,13, 15, 1), the block boundary 1, q0_(j) denotes a pixel value of apixel 21 in the neighboring block 20 closest to, in the correspondingline 22 of pixels 21, 23, 25, 27, the block boundary 1 and q1_(i)denotes a pixel value of a pixel 23 of the neighboring block 20 nextclosest to, in the corresponding line 22 of pixels 21, 23, 25, 27, theblock boundary 1.

This first offset is used in step S41 to modify the pixel value of thepixel 11 closest to the block boundary 1 in the line 12 of pixels 11,13, 15, 17 by adding the first offset to the pixel value, i.e.p0_(j)′=p0_(j)+Δ. Step S41 also modifies the pixel value of the pixel 21closest to the block boundary 1 in the corresponding line 22 of pixels21, 23, 25, 27 by subtracting the first offset from the pixel value,i.e. q0_(j)=q0_(j)−Δ. The method then continues to steps S1 and S2 ofFIG. 1 where the first (d_(p)) and second (d_(q)) filter decision valuesare calculated. A next step S42 compares the first filter decision valueto a first threshold value (T₁). This step S42 corresponds to step S20in FIG. 4. If the first filter decision value is below the threshold themethod continues to step S43.

Step S43 calculates a second offset or delta value Δ_(p) based on

$\frac{{p\; 0_{j}} + {p\; 2_{j}} - {2p\; 1_{j}} + {2\Delta}}{4},$

wherein p2_(j) denotes a pixel value of a pixel 15 second next closestto, in the line 12 of pixels 11, 13, 15, 17, the block boundary 1. Thesecond offset is then used in step S44 to modify the pixel value of thepixel 13 next closest to the block boundary 1 in the line 12 of pixels11, 13, 15, 17 by adding the second offset to the pixel value, i.e.p1_(j)′=p1_(j)+Δ_(p).

The method then continues to step S45. The method also continues in FIG.6 from step S42 to step S45 if the first threshold value is not belowthe first threshold.

Step S45 compares the second filter decision value with a secondthreshold (T₂). This step S45 corresponds to step S23 of FIG. 4. If thesecond filter decision value is below the second threshold the methodcontinues to step S46. Step S46 calculates a third offset Δ_(q) based on

$\frac{{q\; 0_{j}} + {q\; 2_{j}} - {2q\; 1_{j}} - {2\Delta}}{4},$

wherein q2_(j) denotes a pixel value of a pixel 25 in the neighboringblock 20 second next closest to, in the corresponding line 22 of pixels21, 23, 25, 27, the block boundary 1. The third offset is used in stepS47 to modify the pixel value of the pixel 23 next closest to the blockboundary 1 in the corresponding line 22 of pixels 21, 23, 25, 27 byadding the third offset to the pixel value, i.e. q1_(j)′=q1_(j)+Δ_(q).

Steps S42, S43 and S44 can be performed serially in any order or atleast partly in parallel with steps S45, S46 and S47.

In above, the first, second and third offsets are calculated based onparticular equations of pixel values. This means that the first offsetis calculated as a function of

$\frac{{9\left( {{q\; 0_{j}} - {p\; 0_{j}}} \right)} - {3\left( {{q\; 1_{j}} - {p\; 1_{j}}} \right)}}{16},$

the second offset is calculated as a function of

$\frac{{p\; 0_{j}} + {p\; 2_{j}} - {2p\; 1_{j}} + {2\Delta}}{4}$

and the third offset is calculated as a function of

$\frac{{q\; 0_{j}} + {q\; 2_{j}} - {2q\; 1_{j}} - {2\Delta}}{4}.$

Different such functions are possible and can be used in steps S40, S43and S46. Such functions could then be defined so that the calculationsof the offsets are efficiently performed in hardware. In such a case, itis generally preferred not to have any divisions and/or define thefunctions so that the offsets will be an integer value. In anembodiment, (X+8)>>4 is used as an integer-expression of X/16, where >>denotes a right shift operation. Thus, in a particular embodiment stepS40 calculates the first offset to be based on and preferably equal to(9×(q0_(j)−p0_(j))−3×(q1_(j)−p1)+8)>>4. Corresponding integerrepresentations of the second and third offsets could be(((p0_(j)+p2_(j)+1)>>1)−p1_(j)+Δ)>>1 and(((q0_(j)+q2_(j)+1)>>1)−q1_(j)−Δ)>>1.

In an example the modified pixel values as a result of deblocking arecalculated like in the following. In this example, the first filterdecision value is defined as d_(p)=|p2₂−2p1₂+p0₂|+|p2₅−2p1₅+p0₅| and thesecond filter decision value is calculated asd_(q)=|q2₂−2q1₂+q0₂|+|q2₅−2q1₅+q0₅|.

${\bullet \mspace{14mu} \Delta} = \frac{{9\left( {{q\; 0} - {p\; 0}} \right)} - {3\left( {{q\; 1} - {p\; 1}} \right)}}{16}$•  p₀^(′) = p₀ + Δ •  q₀^(′) = q₀ − Δ •  if  d_(p) < thrP$\mspace{20mu} {{\bullet \mspace{14mu} \Delta_{p}} = \frac{{p\; 0} + {p\; 2} - {2p\; 1_{j}} + {2\Delta}}{4}}$  •  p₁^(′) = p₁ + Δ_(p) •  if  d_(q) < thrQ$\mspace{20mu} {{\bullet \mspace{14mu} \Delta_{q}} = \frac{{q\; 0} + {q\; 2} - {2q\; 1} - {2\Delta}}{4}}$  •  q₁^(′) = q₁ + Δ_(q)

Exact formulas for computation of the example above in the programminglanguage can look like in the text below. Here, the Clip3 function isclipping of the output values to the range between the two firstfunction arguments.

Int xCalcDP(Pel* piSrc, Int iOffset) {  returnabs(piSrc[−iOffset*3]−2*piSrc[−iOffset*2]+piSrc[−iOffset]); } IntxCalcDQ(Pel* piSrc, Int iOffset) {  returnabs(piSrc[0]−2*piSrc[iOffset]+piSrc[iOffset*2]); } IntiDP=xCalcDP(piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+2),iOffset)+xCalcDP(piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkId*DEBLOCK_SMALLEST_BLOCK+5),iOffset); IntiDQ=xCalcDQ(piTmpSrc+iSrcStep*(iIdx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+2),iOffset)+xCalcDQ(piTmpSrc+iSrcStep*(Idx*uiPelsInPart+iBlkIdx*DEBLOCK_SMALLEST_BLOCK+5),iOffset); Int iSideThreshold=iBeta/6;Bool bFilterP=(iDP<iSideThreshold); Bool bFilterQ=(iDQ<iSideThreshold);delta=(9*(m4−m3)−3*(m5−m2)+8)>>4; if (abs(delta)<iThrCut) { Inttc2=tc>>1; delta=Clip3(−tc, tc, delta);piSrc[−iOffset]=Clip((m3+delta)); piSrc[0]=Clip((m4−delta));if(bFilterP) { Intdelta1=Clip3(−tc2,tc2,((((m1+m3+1)>>1)−m2+delta)>>1));piSrc[−iOffset*2]=Clip((m2+delta1)); }  if(bFilterQ) { Intdelta2=Clip3(−tc2,tc2,((((m6+m4+1)>>1)−m5−delta)>>1));piSrc[iOffset]=Clip((m5+delta2)); } }

FIG. 7 is a flow diagram illustrating additional optional steps of themethod in FIG. 1. The method continues from step S2 in FIG. 1. A nextstep S50 compares a sum of the first decision value and the seconddecision value with a threshold value (T). If the sum is not below thethreshold value, the method ends. Thus, in such a case no filtering atall is applied to block 10 and neighboring block 20 with regard to theparticular block boundary 1. The block 10 and the neighboring block 20then comprises at lot of local structures, which should not be filteredaway. However, if the sum is below the threshold value the methodcontinues to steps S3 and S4 in FIG. 1, where the determination of howmany pixels to filter is performed based on the first filter decisionvalue (step S3) or the second filter decision value (step S4).

This embodiment has an advantage that it does not require manyadditional computations as the values for the first and second filterdecisions are also used for deciding whether to filter the blockboundary at all.

The embodiments disclosed herein achieve asymmetric deblocking decisionsthat control deblocking filtering to be adaptive to the structure oneach side of a block boundary. The asymmetric decisions means that theamount of filtering applied to one side of the block boundary can differfrom the amount of filtering applied to the other side of the blockboundary, thus providing additional adaptation to the local structure.This improves the objective and subjective video quality.

FIG. 8 is a schematic block diagram of an embodiment of a filteringcontrol device 100. The filtering control device 100 comprises a firstdecision value calculator 110 configured to calculate a first filterdecision value for a block 10 in a video frame based at least on|p2_(i)−2p1_(i)+p0_(i)|. The filtering control device 100 also comprisesa second decision value calculator 120 configured to calculate a second,different filter decision value for the block 10 based on|q2_(i)−2q1_(i)+q0_(i)|.

A first pixel determiner 130 or first pixel determining unit orprocessor is configured to determine how many pixels in a line 12 ofpixels 11, 13, 15, 17 in the block 10 to filter relative to a blockboundary 1 based on the first filter decision value calculated by thefirst decision value calculator 110. A second pixel determiner 140 orsecond pixel determining unit or processor is provided in the filteringcontrol device 100 to determine how many pixels in a corresponding line22 of pixel 21, 23, 25, 27 in a neighboring block 20 of the video frameto filter relative to the block boundary based on the second filterdecision value calculated by the second decision value calculator 120.

In an embodiment, the first pixel determiner 130 is configured todetermine how many pixels in the first line 12 of pixels 11, 13, 15, 17in the block 10 to filter relative to the block boundary 1 based on thefirst filter decision value calculated by the first decision valuecalculator 110 for the first line 12 of pixels 11, 13, 15, 17. Thesecond pixel determiner 140 correspondingly determines in thisembodiment how many pixels in the corresponding first line 22 of pixels21, 23, 25, 27 in the neighboring block 20 to filter relative to theblock boundary 1 based on the second filter decision value calculated bythe second decision value calculator 120 for the corresponding firstline 22 of pixels 21, 23, 25, 27.

In another embodiment, the first decision value calculator 110 isconfigured to calculate the first filter decision value as|p2₂−2p1₂+p0₂|+|p2₅−2p1₅+p0₅| and the second decision value calculator120 is configured to calculate the second filter decision value as|q2₂−2q1₂+q0₂|+|q2₅−2q1₅+q0₅|.

In yet another embodiment, the first decision value calculator 110 isconfigured to calculate the first filter decision value of a first pairas |p2₀−2p1₀+p0₀|+|p2₃−2p1₃+p0₃| and the second decision valuecalculator 120 is configured to calculate the second filter decisionvalue of the first pair as |q2₀−2q1₀+q0₀|+|q2₃−2q1₃+q0₃|. The firstfilter decision value calculator 110 is also configured to calculate thefirst filter decision value of a second pair as|p2₄−2p1₄+p0₄|+|p2₇−2p1₇+p0₇| and the second filter decision valuecalculator 120 is also configured to calculate the second filterdecision value of a the second pair as |q2₄−2q1₄+q0₄|+|q2₇−2q1₇+q0₇|.

FIG. 9 is a schematic block diagram of another embodiment of a filteringcontrol device 100. The filtering control device 100 comprises, in thisembodiment and in addition to the first decision value calculator 110,the second decision value calculator 120, the first pixel determiner 130and the second pixel determiner 140, a third decision value calculator150. The third decision value calculator 150 is then configured tocalculate a third filter decision value as|p2₂−2p1₂+p0₂|+|p2₅−2p1₅+p0₅|. A fourth decision value calculator 160 isalso implemented in the filtering control device 100 and configured tocalculate a fourth filter decision value as|q2₂−2q1₂+q0₂|+|2₅−2q1₅+q0₅|.

In this embodiment, the first filter decision value calculator 110 isconfigured to calculate the first filter decision value if the thirdfilter decision value calculated by the third decision value calculator150 is below a third threshold value. If the third decision value isbelow the third threshold, the first decision value calculator 110calculates a first threshold value for each line i 12 of pixels 11, 13,15, 17 in the block 10 as |p2_(i)−2p1_(i)+p0_(i)|. The first pixeldeterminer 130 then determines, if the third filter decision value isbelow the third threshold value and for each line i 12 of pixels 11, 13,15, 17 in the block 10, how many pixels in the line i 12 of pixels 11,13, 15, 17 in the block 10 to filter relative to the block boundary 1based on the first filter decision value calculated by the firstdecision value calculator 110 for the line i 12 of pixels 11, 13, 15,17.

The second decision value calculator 120 is preferably responsive to acomparison between the fourth filter decision value and a fourththreshold value. Thus, if the fourth filter decision value calculated bythe fourth decision value calculator 160 is below the fourth thresholdthe second decision value calculator 120 calculates a second filterdecision value as |q2_(i)−2q1_(i)+q0_(i)| for each corresponding line i22 of pixels 21, 23, 25, 27 in the neighboring block 20. The secondpixel determiner 240 is configured to determine, if the fourth filterdecision value is below the fourth threshold value and for eachcorresponding line i 22 of pixels 21, 23, 25, 27 in the neighboringblock 20, how many pixels in the corresponding line i 22 of pixels 21,23, 25, 27 in the neighboring block 20 to filter relative to the blockboundary 1 based on the second filter decision value calculated for thecorresponding line i 22 of pixels 21, 23, 25, 27.

FIG. 10 is a schematic block diagram of a further embodiment of afiltering control device 100. In addition to the units 110-140 of theembodiment illustrated in FIG. 8, the filtering control device 100comprises a first comparator 180 configured to compare the first filterdecision value calculated by the first decision value calculator 110 toa first threshold value. A second comparator 182 is correspondinglyconfigured to compare the second filter decision value calculated by thesecond decision value calculator 120 to a second threshold value.

In this embodiment, the first pixel determiner 130 is configured todetermine to filter two pixels in the line 12 of pixels 11, 13, 15, 17in the block 10 relative to the block boundary 1 if the first filterdecision value is below the first threshold value as determined by thefirst comparator 180. However, if the first filter decision value is notbelow the first threshold value the first pixel determiner 130 isinstead configured to determine to filter one pixel in the line 12 ofpixels 11, 13, 15, 17 in the block 10 relative to the block boundary 1.Alternatively, the first pixel determiner 130 is instead configured todetermine to filter no pixels in the line 12 of pixels 11, 13, 15, 17 inthe block 10 relative to the block boundary 1.

The second pixel determiner 140 is configured to determine to filter twopixels in the corresponding line 22 of pixels 21, 23, 25, 27 in theneighboring block 20 relative to the block boundary 1 if the secondfilter decision value is below the second threshold value as determinedby the second comparator 182. However, if the second filter decisionvalue is not below the second threshold the second pixel determiner 140is instead configured to determine to filter one pixel in thecorresponding line 22 of pixels 21, 23, 25, 27 in the neighboring block20 relative to the block boundary 1. Alternatively, the second pixeldeterminer 140 is instead configured to determine to filter no pixels inthe corresponding line 22 of pixels 21, 23, 25, 27 in the neighboringblock 20 relative to the block boundary 1.

In an embodiment the filtering control device 100 of FIG. 10 comprises afirst offset calculator 181 configured to calculate a first offset basedon

$\frac{{9\left( {{q\; 0_{j}} - {p\; 0_{j}}} \right)} - {3\left( {{q\; 1_{j}} - {p\; 1_{j}}} \right)}}{16}.$

A first pixel modifier 190 of the filtering control device 100 isconfigured to modify the pixel value of the pixel 11 closest to theblock boundary 1 in the line 12 of pixels 11, 13, 15, 17 by adding thefirst offset to the pixel value of this pixel 11. A second pixel valuemodifier 192 is configured to modify the pixel value of the pixel 21closest to the block boundary 1 in the corresponding line 12 of pixels21, 23, 25, 27 by subtracting the first offset from the pixel value ofthis pixel 21.

A second offset calculator 183 is preferably implemented in thefiltering control device 100 to calculate a second offset if the firstfilter decision value is below the first threshold value as determinedby the first comparator 180. The second offset is then calculated basedon

$\frac{{p\; 0_{j}} + {p\; 2_{j}} - {2p\; 1_{j}} + {2\Delta}}{4}.$

A third pixel modifier 194 is operated if the first filter decisionvalue is below the first threshold value. In such a case, the thirdpixel modifier 194 is configured to modify the pixel value of the pixel13 next closest to the block boundary 1 in the line 12 of pixels 11, 13,15, 17 by adding the second offset to the pixel value of this pixel 13.

A third offset calculator 185 is configured to calculate a third offsetbased on

$\frac{{q\; 0_{j}} + {q\; 2_{j}} - {2q\; 1_{j}} - {2\Delta}}{4}$

if the second filter decision value is below the second threshold valueas determined by the second comparator 182. If the second filterdecision value is below the second threshold value a fourth pixelmodifier 196 of the filtering control device 100 is configured to modifythe pixel value of the pixel 23 next closest to the block boundary 1 inthe corresponding line 22 of pixels 21, 23, 25, 27 by adding the thirdoffset to the pixel value of this pixel 23.

The embodiments of the filtering control device 100 discussed in theforegoing in connection with FIGS. 9 and 10 compares filter decisionvalues to respective threshold values. In an embodiment, such thresholdvalues are calculated by the filtering control device 100 for theparticular block boundary 1. The filtering control device 100 thenpreferably comprises a threshold determiner 170 or threshold determiningprocessor or unit configured to determine the first threshold value usedby the first comparator 180 in FIG. 10 and the third threshold valueused by the filtering control device 100 in FIG. 9 based on aquantization parameter associated with the block 10. Correspondingly,the threshold determiner 170 correspondingly preferably determines thesecond threshold value used by the second comparator 182 in FIG. 10 andthe fourth threshold value used by the filtering control device 100 inFIG. 9 based on a quantization parameter associated with the neighboringblock 20.

FIG. 11 is schematic block diagram of yet another embodiment of afiltering control device 100. In addition to the units 110-140 of theembodiment illustrated in FIG. 8, the filtering control device 100comprises in this embodiment a third comparator 184 configured tocompare a sum of the first filter decision value and the second filterdecision value to a threshold value. If the sum is equal to or exceedsthe threshold value the first and second pixel determiners 130, 140 willnot determine any number of pixels to filter since no filtering is to beapplied to the block 10 and the neighboring block 20 with regard to theparticular block boundary 1. However, if the sum is below the threshold,the first and second pixel determiners 130, 140 are operated todetermine the number of pixels to filter based on the first or secondfilter decision values, respectively.

The embodiments of the filtering control device 100 discussed in theforegoing and disclosed in FIGS. 8-11 can be combined. For instance, thethird value calculator 150 and fourth value calculator 160 of FIG. 9 canbe implemented in any of the embodiments disclosed in FIG. 10 or 11.Correspondingly, the third comparator 184 of FIG. 11 can be implementedin any of the embodiments disclosed in FIG. 9 or 10.

Although the respective units 110-196 disclosed in conjunction withFIGS. 8-11 have been disclosed as physically separate units 110-196 inthe filtering control device 100, and all may be special purposecircuits, such as ASICs (Application Specific Integrated Circuits),alterative embodiments of the filtering control device 100 are possiblewhere some or all of the units 110-196 are implemented as computerprogram modules running on a general purpose processor. Such anembodiment is disclosed in FIG. 12.

FIG. 12 schematically illustrates an embodiment of a computer 70 havinga processing unit 72, such as a DSP (Digital Signal Processor) or CPU(Central Processing Unit). The processing unit 72 can be a single unitor a plurality of units for performing different steps of the methoddescribed herein. The computer 70 also comprises an input/output (I/O)unit 71 for receiving recorded or generated video frames or encodedvideo frames and outputting encoded video frame or decoded video data.The I/O unit 71 has been illustrated as a single unit in FIG. 12 but canlikewise be in the form of a separate input unit and a separate outputunit.

Furthermore, the computer 70 comprises at least one computer programproduct 73 in the form of a non-volatile memory, for instance an EEPROM(Electrically Erasable Programmable Read-Only Memory), a flash memory ora disk drive. The computer program product 73 comprises a computerprogram 74, which comprises code means which when run on or executed bythe computer 70, such as by the processing unit 72, causes the computer70 to perform the steps of the method described in the foregoing inconnection with FIG. 1. Hence, in an embodiment the code means in thecomputer program 74 comprises a first decision value calculating (DVC)module 310 for calculating the first filter decision value for a block,a second pixel value calculating module 320 for calculating the secondfilter decision value for the block, a first pixel determining (PD)module 330 for determining how many pixels in the line 12 of pixels 11,13, 15, 17 to filter and a second pixel determining module 340 fordetermining how many pixels in the corresponding line 22 of pixels 21,23, 25, 27 to filter. These modules 310-340 essentially perform thesteps of the flow diagram in FIG. 1 when run on the processing unit 72.Thus, when the different modules 310-340 are run on the processing unit72 they correspond to the corresponding units 110-140 of FIGS. 8-11.

The computer program 74 may additionally comprise a third decision valuecalculating module, a fourth decision value calculating module, athreshold determining module, a first comparing module, second comparingmodule, a third comparing module, a first offset calculating module, asecond offset calculating module, a third offset calculating module, afirst pixel modifying module, a second pixel modifying module, a thirdpixel modifying module and/or a fourth pixel modifying module to performthe operation of the corresponding units 150-196 in FIGS. 9-11.

The computer 70 of FIG. 12 can be a user equipment or be present in auser equipment. In such a case, the user equipment may additionallycomprise or be connected to a display to display video data.

The filtering control device of FIGS. 8-11 is preferably used in videocoding. It functions and is therefore preferably implemented both in avideo encoder and in a video decoder. The video decoder can beimplemented preferably in hardware but also in software. The same holdsfor the video encoder.

FIG. 13 is a schematic block diagram of an encoder 40 for encoding ablock of pixels in a video frame of a video sequence according to anembodiment.

A current block of pixels is predicted by performing a motion estimationby a motion estimator 50 from an already provided block of pixels in thesame frame or in a previous frame. The result of the motion estimationis a motion or displacement vector associated with the reference block,in the case of inter prediction. The motion vector is utilized by amotion compensator 50 for outputting an inter prediction of the block ofpixels.

An intra predictor 49 computes an intra prediction of the current blockof pixels. The outputs from the motion estimator/compensator 50 and theintra predictor 49 are input in a selector 51 that either selects intraprediction or inter prediction for the current block of pixels. Theoutput from the selector 51 is input to an error calculator in the formof an adder 41 that also receives the pixel values of the current blockof pixels. The adder 41 calculates and outputs a residual error as thedifference in pixel values between the block of pixels and itsprediction.

The error is transformed in a transformer 42, such as by a discretecosine transform, and quantized by a quantizer 43 followed by coding inan encoder 44, such as by entropy encoder. In inter coding, also theestimated motion vector is brought to the encoder 44 for generating thecoded representation of the current block of pixels.

The transformed and quantized residual error for the current block ofpixels is also provided to a inverse quantizer 45 and inversetransformer 46 to retrieve the original residual error. This error isadded by an adder 47 to the block prediction output from the motioncompensator 50 or the intra predictor 49 to create a reference block ofpixels that can be used in the prediction and coding of a next block ofpixels. This new reference block is first processed by a filteringcontrol device 100 according to the embodiments in order to control anydeblocking filtering that is applied to the reference block to combatany blocking artifact. The processed new reference block is thentemporarily stored in a frame buffer 48, where it is available to theintra predictor 49 and the motion estimator/compensator 50.

FIG. 14 is a corresponding schematic block diagram of a decoder 60comprising a filtering control device 100 according to the embodiments.The decoder 60 comprises a decoder 61, such as entropy decoder, fordecoding an encoded representation of a block of pixels to get a set ofquantized and transformed residual errors. These residual errors aredequantized in an inverse quantizer 62 and inverse transformed by aninverse transformer 63 to get a set of residual errors.

These residual errors are added in an adder 64 to the pixel values of areference block of pixels. The reference block is determined by a motionestimator/compensator 67 or intra predictor 66, depending on whetherinter or intra prediction is performed. A selector 68 is therebyinterconnected to the adder 64 and the motion estimator/compensator 67and the intra predictor 66. The resulting decoded block of pixels outputform the adder 64 is input to a filtering control device 100 accordingto the embodiments in order to control any deblocking filter that isapplied to combat any blocking artifacts. The filtered block of pixelsis output form the decoder 60 and is furthermore preferably temporarilyprovided to a frame buffer 65 and can be used as a reference block ofpixels for a subsequent block of pixels to be decoded. The frame buffer65 is thereby connected to the motion estimator/compensator 67 to makethe stored blocks of pixels available to the motionestimator/compensator 67.

The output from the adder 64 is preferably also input to the intrapredictor 66 to be used as an unfiltered reference block of pixels.

In the embodiments disclosed in FIGS. 13 and 14 the filtering controldevice 100 controls deblocking filtering in the form of so calledin-loop filtering. In an alternative implementation at the decoder 60the filtering control device 100 is arranged to perform so calledpost-processing filtering. In such a case, the filtering control device100 operates on the output frames outside of the loop formed by theadder 64, the frame buffer 65, the intra predictor 66, the motionestimator/compensator 67 and the selector 68. No deblocking filteringand filtering control is then typically done at the encoder.

FIG. 15 is a schematic block diagram of a user equipment or mediaterminal 80 housing a decoder 60 with a filtering control device. Theuser equipment 80 can be any device having media decoding functions thatoperates on an encoded video stream of encoded video frames to therebydecode the video frames and make the video data available. Non-limitingexamples of such devices include mobile telephones and other portablemedia players, tablets, desktops, notebooks, personal video recorders,multimedia players, video streaming servers, set-top boxes, TVs,computers, decoders, game consoles, etc. The user equipment 80 comprisesa memory 84 configured to store encoded video frames. These encodedvideo frames can have been generated by the user equipment 80 itself.Alternatively, the encoded video frames are generated by some otherdevice and wirelessly transmitted or transmitted by wire to the userequipment 80. The user equipment 80 then comprises a transceiver(transmitter and receiver) or input and output port 82 to achieve thedata transfer.

The encoded video frames are brought from the memory 84 to a decoder 60,such as the decoder illustrated in FIG. 14. The decoder 60 comprises afiltering control device 100 according to embodiments. The decoder 60then decodes the encoded video frames into decoded video frames. Thedecoded video frames are provided to a media player 86 that isconfigured to render the decoded video frames into video data that isdisplayable on a display or screen 88 of or connected to the userequipment 80.

In FIG. 15, the user equipment 80 has been illustrated as comprisingboth the decoder 60 and the media player 86, with the decoder 60implemented as a part of the media player 86. This should, however,merely be seen as an illustrative but non-limiting example of animplementation embodiment for the user equipment 80. Also distributedimplementations are possible where the decoder 60 and the media player86 are provided in two physically separated devices are possible andwithin the scope of user equipment 80 as used herein. The display 88could also be provided as a separate device connected to the userequipment 80, where the actual data processing is taking place.

FIG. 16 illustrates another embodiment of a user equipment 80 thatcomprises en encoder, such as the encoder of FIG. 13, comprising afiltering control device according to the embodiments. The encoder 40 isthen configured to encode video frames received by the I/O unit 82and/or generated by the user equipment 80 itself. In the latter case,the user equipment 80 preferably comprises a media engine or recorder,such as in the form of or connected to a (video) camera. The userequipment 80 may optionally also comprise a media player 86, such as amedia player 86 with a decoder and filtering control device according tothe embodiments, and a display 88.

As illustrated in FIG. 17, the encoder 40 and/or decoder 60, such asillustrated in FIGS. 13 and 14, may be implemented in a network device30 being or belonging to a network node in a communication network 32between a sending unit 34 and a receiving user equipment 36. Such anetwork device 30 may be a device for converting video according to onevideo coding standard to another video coding standard, for example, ifit has been established that the receiving user equipment 36 is onlycapable of or prefers another video coding standard than the one sentfrom the sending unit 34. The network device 30 can be in the form of orcomprised in a radio base station, a Node-B or any other network node ina communication network 32, such as a radio-based network.

The embodiments described above are to be understood as a fewillustrative examples of the present invention. It will be understood bythose skilled in the art that various modifications, combinations andchanges may be made to the embodiments without departing from the scopeof the present invention. In particular, different part solutions in thedifferent embodiments can be combined in other configurations, wheretechnically possible. The scope of the present invention is, however,defined by the appended claims.

What is claimed:
 1. A method for filtering control applicable to a blockof multiple pixels in a video frame, each pixel having a respectivepixel value, said method comprising: calculating a first filter decisionvalue for said block, by only using pixels p2_(i), p1_(i) and p0_(i),based on:|p2_(i)−2p1_(i) +p0_(i)| wherein p0_(i) denotes a pixel value of a pixelclosest to, in a first line of pixels in said block, a block boundary toa neighboring block of multiple pixels in said video frame, p1_(i)denotes a pixel value of a pixel next closest to, in said first line ofpixels, said block boundary and p2_(i) denotes a pixel value of a pixelsecond next closest to, in said first line of pixels, said blockboundary; calculating a second filter decision value for saidneighboring block, by only using pixels q2_(i), q1_(i) and q0_(i), basedon:|q2_(i)−2q1_(i) +q0_(i)|  wherein q0_(i) denotes a pixel value of apixel in said neighboring block closest to, in a corresponding firstline of pixels in said neighboring block, said block boundary, q1_(i)denotes a pixel value of a pixel of said neighboring block next closestto, in said corresponding first line of pixels, said block boundary andq2_(i) denotes a pixel value of a pixel in said neighboring block secondnext closest to, in said corresponding first line of pixels, said blockboundary; determining how many pixels in said first line of pixels insaid block to filter relative to said block boundary based on acomparison of said first filter decision value to a first thresholdvalue; and determining how many pixels in said corresponding first lineof pixels in said neighboring block to filter relative to said blockboundary based on a comparison of said second filter decision value to asecond threshold value. wherein: calculating said first filter decisionvalue comprises calculating said first filter decision value as:|p2₀−2p1₀ +p0₀ |+|p2₃−2p1₃ +p0₃|  wherein p0₀ denotes said pixel valueof said pixel closest to, in said first line of pixels, said blockboundary, p1₀ denotes said pixel value of said pixel next closest to, insaid first line of pixels, said block boundary, p2₀ denotes said pixelvalue of said pixel second next closest to, in said first line ofpixels, said block boundary, p0₃ denotes a pixel value of a pixelclosest to, in a second line of pixels in said block, said blockboundary, p1₃ denotes a pixel value of a pixel next closest to, in saidsecond line of pixels, said block boundary and p2, denotes a pixel valueof a pixel second next closest to, in said second line of pixels, saidblock boundary; and calculating said second filter decision valuecomprises calculating said second filter decision value as:|q2₀−2q1₀ +q0₀ |+|q2₃−2q1₃ +q0₃|  wherein q0₀ denotes said pixel valueof said pixel in said neighboring block closest to, in saidcorresponding first line of pixels, said block boundary, q1₀ denotessaid pixel value of said pixel of said neighboring block next closestto, in said corresponding first line of pixels, said block boundary, q2₀denotes said pixel value of said pixel in said neighboring block secondnext closest to, in said corresponding first line of pixels, said blockboundary, q0₃ denotes a pixel value of a pixel in said neighboring blockclosest to, in a corresponding second line of pixels in said neighboringblock, said block boundary, q1₃ denotes a pixel value of a pixel of saidneighboring block next closest to, in said corresponding second line ofpixels, said block boundary and q2₃ denotes a pixel value of a pixel insaid neighboring block second next closest to, in said correspondingsecond line of pixels, said block boundary; and wherein: determining howmany pixels in said first line of pixels in said block to filtercomprises: comparing said first filter decision value to a firstthreshold value; determining to filter two pixels in said first line ofpixels in said block relative to said block boundary if said firstfilter decision value is below said first threshold value; anddetermining to filter one pixel in said first line of pixels in saidblock relative to said block boundary if said first filter decisionvalue is equal to or exceeds said first threshold value; and determininghow many pixels in said corresponding first line of pixels in saidneighboring block to filter comprises: comparing said second filterdecision value to a second threshold value; determining to filter twopixels in said corresponding first line of pixels in said neighboringblock relative to said block boundary if said second filter decisionvalue is below said second threshold value; and determining to filterone pixel in said corresponding first line of pixels in said neighboringblock relative to said block boundary if said second filter decisionvalue is equal to or exceeds said second threshold value.
 2. A methodfor filtering control applicable to a block of multiple pixels in avideo frame, each pixel having a respective pixel value, said methodcomprising: calculating a first filter decision value for said block, byonly using pixels p2_(i), p1_(i) and p0_(i), based on:|p2_(i)−2p1_(i) +p0_(i)| wherein p0_(i) denotes a pixel value of a pixelclosest to, in a first line of pixels in said block, a block boundary toa neighboring block of multiple pixels in said video frame, p1_(i)denotes a pixel value of a pixel next closest to, in said first line ofpixels, said block boundary and p2_(i) denotes a pixel value of a pixelsecond next closest to, in said first line of pixels, said blockboundary; calculating a second filter decision value for saidneighboring block, by only using pixels q2_(i), q1_(i) and q0_(i), basedon:|q2_(i)−2q1_(i) +q0_(i)|  wherein q0_(i) denotes a pixel value of apixel in said neighboring block closest to, in a corresponding firstline of pixels in said neighboring block, said block boundary, q1_(i)denotes a pixel value of a pixel of said neighboring block next closestto, in said corresponding first line of pixels, said block boundary andq2_(i) denotes a pixel value of a pixel in said neighboring block secondnext closest to, in said corresponding first line of pixels, said blockboundary; determining how many pixels in said first line of pixels insaid block to filter relative to said block boundary based on acomparison of said first filter decision value to a first thresholdvalue; and determining how many pixels in said corresponding first lineof pixels in said neighboring block to filter relative to said blockboundary based on a comparison of said second filter decision value to asecond threshold value. wherein: calculating said first filter decisionvalue comprises calculating said first filter decision value as:|p2₀−2p1₀ +p0₀ |+|p2₃−2p1₃ +p0₃|  wherein p0₀ denotes said pixel valueof said pixel closest to, in said first line of pixels, said blockboundary, p1₀ denotes said pixel value of said pixel next closest to, insaid first line of pixels, said block boundary, p2₀ denotes said pixelvalue of said pixel second next closest to, in said first line ofpixels, said block boundary, p0₃ denotes a pixel value of a pixelclosest to, in a second line of pixels in said block, said blockboundary, p1₃ denotes a pixel value of a pixel next closest to, in saidsecond line of pixels, said block boundary and p2₃ denotes a pixel valueof a pixel second next closest to, in said second line of pixels, saidblock boundary; and calculating said second filter decision valuecomprises calculating said second filter decision value as:|q2₀−2q1₀ +q0₀ |+|q2₃−2q1₃ +q0₃|  wherein q0₀ denotes said pixel valueof said pixel in said neighboring block closest to, in saidcorresponding first line of pixels, said block boundary, q1₀ denotessaid pixel value of said pixel of said neighboring block next closestto, in said corresponding first line of pixels, said block boundary, q2₀denotes said pixel value of said pixel in said neighboring block secondnext closest to, in said corresponding first line of pixels, said blockboundary, q0₃ denotes a pixel value of a pixel in said neighboring blockclosest to, in a corresponding second line of pixels in said neighboringblock, said block boundary, q1₃ denotes a pixel value of a pixel of saidneighboring block next closest to, in said corresponding second line ofpixels, said block boundary and q2₃ denotes a pixel value of a pixel insaid neighboring block second next closest to, in said correspondingsecond line of pixels, said block boundary; and wherein: determining howmany pixels in said first line of pixels in said block to filtercomprises: comparing said first filter decision value to a firstthreshold value; determining to filter two pixels in said first line ofpixels in said block relative to said block boundary if said firstfilter decision value is below said first threshold value; anddetermining to filter no pixels in said first line of pixels in saidblock relative to said block boundary if said first filter decisionvalue is equal to or exceeds said first threshold value; and determininghow many pixels in said corresponding first line of pixels in saidneighboring block to filter comprises: comparing said second filterdecision value to a second threshold value; determining to filter twopixels in said corresponding first line of pixels in said neighboringblock relative to said block boundary if said second filter decisionvalue is below said second threshold value; and determining to filter nopixels in said corresponding first line of pixels in said neighboringblock relative to said block boundary if said second filter decisionvalue is equal to or exceeds said second threshold value.
 3. A filteringcontrol device comprising: a processing circuit configured to: calculatea first filter decision value for a block of multiple pixels in a videoframe, by only using pixels p2_(i), p1_(i) and p0_(i), based on:|p2_(i)−2p1_(i) +p0_(i)|  wherein p0_(i) denotes a pixel value of apixel closest to, in a first line of pixels in said block, a blockboundary to a neighboring block of multiple pixels in said video frame,p1_(i) denotes a pixel value of a pixel next closest to, in said firstline of pixels, said block boundary and p2_(i) denotes a pixel value ofa pixel second next closest to, in said first line of pixels, said blockboundary; calculate a second filter decision value for a neighboringblock, by only using pixels q2_(i), q1_(i) and q0_(i), based on:|q2_(i)−2q1_(i) +q0_(i)|  wherein q0_(i) denotes a pixel value of apixel in said neighboring block closest to, in a corresponding firstline of pixels in said neighboring block, said block boundary, q1_(i)denotes a pixel value of a pixel of said neighboring block next closestto, in said corresponding first line of pixels, said block boundary andq2_(i) denotes a pixel value of a pixel in said neighboring block secondnext closest to, in said corresponding first line of pixels, said blockboundary; determine how many pixels in a first line of pixels in saidblock to filter relative to said block boundary based on said firstfilter decision value calculated by said first decision valuecalculator; and determine how many pixels in a corresponding first lineof pixels in said neighboring block to filter relative to said blockboundary based on said second filter decision value calculated by saidsecond decision value calculator, wherein compare said first filterdecision value calculated by said first decision value calculator to afirst threshold value; and compare said second filter decision valuecalculated by said second decision value calculator to a secondthreshold value; wherein the processing circuit is configured to:calculate said first filter decision value as:|p2₀−2p1₀ +p0₀ |+|p2₃−2p1₃ +p0₃|  wherein p0₀ denotes said pixel valueof said pixel closest to, in said first line of pixels, said blockboundary, p1₀ denotes said pixel value of said pixel next closest to, insaid first line of pixels, said block boundary, p2₀ denotes said pixelvalue of said pixel second next closest to, in said first line ofpixels, said block boundary, p0₃ denotes a pixel value of a pixelclosest to, in a second line of pixels in said block, said blockboundary, p1₃ denotes a pixel value of a pixel next closest to, in saidsecond line of pixels, said block boundary and p2₃ denotes a pixel valueof a pixel second next closest to, in said second line of pixels, saidblock boundary; and calculate said second filter decision value as:|q2₀−2q1₀ +q0₀ |+|q2₃−2q1₃ +q0₃|  wherein q0₀ denotes said pixel valueof said pixel in said neighboring block closest to, in saidcorresponding first line of pixels, said block boundary, q1₀ denotessaid pixel value of said pixel of said neighboring block next closestto, in said corresponding first line of pixels, said block boundary, q2₀denotes said pixel value of said pixel in said neighboring block secondnext closest to, in said corresponding first line of pixels, said blockboundary, q0₃ denotes a pixel value of a pixel in said neighboring blockclosest to, in a corresponding second line of pixels in said neighboringblock, said block boundary, q1₃ denotes a pixel value of a pixel of saidneighboring block next closest to, in said corresponding second line ofpixels, said block boundary and q2_(i) denotes a pixel value of a pixelin said neighboring block second next closest to, in said correspondingsecond line of pixels, said block boundary.
 4. The filtering controldevice of claim 3, wherein the processing circuit is configured to: i)determine to filter two pixels in said first line of pixels in saidblock relative to said block boundary if said first filter decisionvalue is below said first threshold value as determined by said firstcomparator and ii) determine to filter one pixel in said first line ofpixels in said block relative to said block boundary if said firstfilter decision value is equal to or exceeds said first threshold valueas determined by said first comparator; and i) determine to filter twopixels in said corresponding first line of pixels in said neighboringblock relative to said block boundary if said second filter decisionvalue is below said second threshold value as determined by said secondcomparator and ii) determine to filter one pixel in said correspondingfirst line of pixels in said neighboring block relative to said blockboundary if said second filter decision value is equal to or exceedssaid second threshold value as determined by said second comparator. 5.The filtering control device of claim 3, wherein the processing circuitis configured to: compare said first filter decision value to a firstthreshold value; and compare said second filter decision value to asecond threshold value, wherein i) determine to filter two pixels insaid first line of pixels in said block relative to said block boundaryif said first filter decision value is below said first threshold valueas determined by said first comparator and ii) determine to filter nopixels in said first line of pixels in said block relative to said blockboundary if said first filter decision value is equal to or exceeds saidfirst threshold value as determined by said first comparator; and i)determine to filter two pixels in said corresponding first line ofpixels in said neighboring block relative to said block boundary if saidsecond filter decision value is below said second threshold value asdetermined by said second comparator and ii) determine to filter nopixels in said corresponding first line of pixels in said neighboringblock relative to said block boundary if said second filter decisionvalue is equal to or exceeds said second threshold value as determinedby said second comparator.
 6. The filtering control device of claim 3,wherein the processing circuit is configured to i) determine said firstthreshold value based on a quantization parameter associated with saidblock, and ii) determine said second threshold value based on aquantization parameter associated with said neighboring block.
 7. Thefiltering control device of claim 3, wherein the processing circuit isconfigured to: calculate a first offset Δ based$\frac{{9\left( {{q\; 0_{j}} - {p\; 0_{j}}} \right)} - {3\left( {{q\; 1_{j}} - {p\; 1_{j}}} \right)}}{16},$ wherein p0_(j) denotes a pixel value of a pixel closest to, in saidfirst line of pixels, said block boundary, p1_(j) denotes a pixel valueof a pixel next closest to, in said first line of pixels, said blockboundary, q0_(j) denotes a pixel value of a pixel in said neighboringblock closest to, in said corresponding first line of pixels, said blockboundary and q1_(i) denotes a pixel value of a pixel of said neighboringblock next closest to, in said corresponding first line of pixels, saidblock boundary; modify said pixel value of said pixel closest to saidblock boundary in said first line of pixels by adding said first offsetcalculated by said first offset calculator to said pixel value of saidpixel closest to said block boundary in said first line of pixels;modify said pixel value of said pixel in said neighboring block closestto said block boundary in said corresponding first line of pixels bysubtracting said first offset calculated by said first offset calculatorfrom said pixel value of said pixel in said neighboring block closest tosaid block boundary in said corresponding first line of pixels;calculate, if said first filter decision value is below said firstthreshold value, a second offset based on$\frac{{p\; 0_{j}} + {p\; 2_{j}} - {2p\; 1_{j}} + {2\Delta}}{4},$ wherein p2_(j) denotes a pixel value of a pixel second next closest to,in said first line of pixels, said block boundary; modify, if said firstfilter decision value is below said first threshold, said pixel value ofsaid pixel next closest to said block boundary in said first line ofpixels by adding said second offset calculated by said second offsetcalculator to said pixel value of said pixel next closest to said blockboundary in said first line of pixels; calculate, if said second filterdecision value is below said second threshold value, a third offsetbased on$\frac{{q\; 0_{j}} + {q\; 2_{j}} - {2q\; 1_{j}} - {2\Delta}}{4},$ wherein q2_(j) denotes a pixel value of a pixel in said neighboringblock second next closest to, in said corresponding first line ofpixels, said block boundary; and modify, if said second filter decisionvalue is below said second threshold, said pixel value of said pixel insaid neighboring block next closest to said block boundary in saidcorresponding first line of pixels by adding said third offset to saidpixel value of said pixel in said neighboring block next closest to saidblock boundary in said corresponding first line of pixels.
 8. Thefiltering control device of claim 3, wherein the processing circuit isconfigured to: compare a sum of said first filter decision value andsaid second filter decision value to a threshold value, whereindetermine, if said sum of said first filter decision value and saidsecond filter decision value is below said threshold value, how manypixels in said first line of pixels in said block to filter relative tosaid block boundary based on said first filter decision value; anddetermine, if said sum of said first filter decision value and saidsecond filter decision value is below said threshold value, how manypixels in said corresponding first line of pixels in said neighboringblock to filter relative to said block boundary based on said secondfilter decision value.
 9. An encoder comprising the filtering controldevice of claim
 3. 10. A user equipment comprising: a memory configuredto store video frames; and the encoder of claim 9 configured to encodesaid video frames into encoded video frames, wherein said memory isfurther configured to store said encoded video frames.
 11. A decodercomprising the filtering control device of claim
 3. 12. A user equipmentcomprising: a memory configured to store encoded video frames; thedecoder of claim 11 configured to decode said encoded video frames intodecoded video frames; and a media player configured to render saiddecoded video frames into video data displayable on a display.
 13. Anon-transitory computer-readable medium comprising, stored thereupon, acomputer program for filtering control of a block of multiple pixels ina video frame, each pixel having a respective pixel value, said computerprogram comprising program code that when run on a computer causes thecomputer to: calculate a first filter decision value for said block, byonly using pixels p2_(i), p1_(i), and p0_(i), based on:|p2_(i)−2p1_(i) +p0_(i)|  wherein p0_(i) denotes a pixel value of apixel closest to, in a first line of pixels in said block, a blockboundary to a neighboring block of multiple pixels in said video frame,p1_(i) denotes a pixel value of a pixel next closest to, in said firstline of pixels, said block boundary and p2_(i) denotes a pixel value ofa pixel second next closest to, in said first line of pixels, said blockboundary; calculate a second filter decision value for said neighboringblock, by only using pixels q2_(i), q1_(i) and q0_(i), based on:|q2_(i)−2q1_(i) +q0_(i)|  wherein q0_(i) denotes a pixel value of apixel in said neighboring block closest to, in a corresponding firstline of pixels in said neighboring block, said block boundary, q1_(i)denotes a pixel value of a pixel of said neighboring block next closestto, in said corresponding first line of pixels, said block boundary andq2_(i) denotes a pixel value of a pixel in said neighboring block secondnext closest to, in said corresponding first line of pixels, said blockboundary; determine how many pixels in a first line of pixels in saidblock to filer relative to said block boundary based on said firstfilter decision value; and determine how many pixels in a correspondingfirst line of pixels in said neighboring block to filter relative tosaid block boundary based on said second filter decision value, whereindetermining how many pixels in said first line of pixels in said blockto filter comprises determining how many pixels in said first line ofpixels in said block to filter relative to said block boundary based ona comparison of said first filter decision value to a first thresholdvalue; and determining how many pixels in said corresponding first lineof pixels in said neighboring block to filter comprises determining howmany pixels in said corresponding first line of pixels in saidneighboring block to filter relative to said block boundary based on acomparison of said second filter decision value to a second thresholdvalue; and wherein the program code is further configured to cause thecomputer to: calculate said first filter decision value as:|p2₀−2p1₀ +p0₀ |+|p2₃−2p1₃ +p0₃|  wherein p0₀ denotes said pixel valueof said pixel closest to, in said first line of pixels, said blockboundary, p1₀ denotes said pixel value of said pixel next closest to, insaid first line of pixels, said block boundary, p2₀ denotes said pixelvalue of said pixel second next closest to, in said first line ofpixels, said block boundary, p0₃ denotes a pixel value of a pixelclosest to, in a second line of pixels in said block, said blockboundary, p1₃ denotes a pixel value of a pixel next closest to, in saidsecond line of pixels, said block boundary and p2₃ denotes a pixel valueof a pixel second next closest to, in said second line of pixels, saidblock boundary; and calculate said second filter decision value as:|q2₀−2q1₀ +q0₁ |+|q2₃−2q1₃ +q0₃|  wherein q0₀ denotes said pixel valueof said pixel in said neighboring block closest to, in saidcorresponding first line of pixels, said block boundary, q1₀ denotessaid pixel value of said pixel of said neighboring block next closestto, in said corresponding first line of pixels, said block boundary, q2₀denotes said pixel value of said pixel in said neighboring block secondnext closest to, in said corresponding first line of pixels, said blockboundary, q0₃ denotes a pixel value of a pixel in said neighboring blockclosest to, in a corresponding second line of pixels in said neighboringblock, said block boundary, q1₃ denotes a pixel value of a pixel of saidneighboring block next closest to, in said corresponding second line ofpixels, said block boundary and q2₃ denotes a pixel value of a pixel insaid neighboring block second next closest to, in said correspondingsecond line of pixels, said block boundary.